package com.itheima.day05.simpledate;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MiaoSha {
    public static void main(String[] args) throws ParseException {
        String start = "2019-09-01 00:00:00";
        String end = "2019-09-01 00:10:00";
        String xj = "2019-09-01 00:05:00";
        String xp = "2019-09-01 00:10:01";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date startDate =sdf.parse(start);
        Date endDate =sdf.parse(end);
        Date xjDate =sdf.parse(xj);
        Date xpDate =sdf.parse(xp);
        if (xjDate.getTime() >= startDate.getTime() && xjDate.getTime() <= endDate.getTime()) {
            System.out.println("xj秒杀成功");
        } else {
            System.out.println("xj秒杀失败");
        }
        if (xpDate.getTime() >= startDate.getTime() && xpDate.getTime() <= endDate.getTime()) {
            System.out.println("xp秒杀成功");
        } else {
            System.out.println("xp秒杀失败");
        }
    }
}
